{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "9a78baa7-63b7-43f2-8e53-4e064efc0f0d",
   "metadata": {},
   "source": [
    "<center><img src=\"./image/CLBLOGO.jpg\" alt=\"创乐博\" style=\"width: 300px;\"/></center>\n",
    "\n",
    "# 25.DS18B20温度传感器实验\n",
    "\n",
    "@－－－－湖南创乐博智能科技有限公司－－－－<br>\n",
    "@  文件名：25.DS18B20 温度传感器实验.py <br>\n",
    "@  版本：V2.0 <br>\n",
    "@  author: zhulin<br>\n",
    "@  说明：DS18B20温度传感器实验\n",
    "DS18B20温度传感器实验，通过树莓派的单总线通讯的方式建立通讯，DS18B20有着唯一的ID号，一般为28-XXXXXXX,在操作之前我们要获取这个唯一的ID号！！！！！！<br>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "18eeae8d-41bf-4a01-9bfa-9905f97d7aca",
   "metadata": {},
   "source": [
    "## 1.导入必要的库文件"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "6783bd1e-41be-4c92-b09b-c1db11e9fdec",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import os\n",
    "\n",
    "os.system('modprobe w1-gpio')\n",
    "os.system('modprobe w1-therm')"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "993b83e8-b271-4420-9619-a216088a8f56",
   "metadata": {},
   "source": [
    "## 2.ds18b20 设备ID"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "e495a5d8-b906-402d-b6d2-198f0c76555c",
   "metadata": {},
   "outputs": [],
   "source": [
    "makerobo_ds18b20 = '28-4d0cd4445032'  # ds18b20 设备，每个设备地址都会不一样，需要修改"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f5f58331-df2f-409c-b08b-1401a5100a80",
   "metadata": {},
   "source": [
    "## 3.初始化函数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "24bb5df6-9701-49a1-8df4-dcbd1a87c5fc",
   "metadata": {},
   "outputs": [],
   "source": [
    "def makerobo_setup():\n",
    "\tglobal makerobo_ds18b20  # 全局变量\n",
    "\t# 获取 ds18b20 地址\n",
    "\tfor i in os.listdir('/sys/bus/w1/devices'):\n",
    "\t\tif i != 'w1_bus_master1':\n",
    "\t\t\tmakerobo_ds18b20 = i       # ds18b20存放在ds18b20地址"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bf81ed90-ea51-4447-b522-85494d089b54",
   "metadata": {},
   "source": [
    "## 4.功能函数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "20561d89-e334-41e0-9358-07f9b385ffdd",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 读取ds18b20地址数据\n",
    "def makerobo_read():\n",
    "    makerobo_location = '/sys/bus/w1/devices/' + makerobo_ds18b20 + '/w1_slave' # 保存ds18b20地址信息\n",
    "    makerobo_tfile = open(makerobo_location)  # 打开ds18b20 \n",
    "    makerobo_text = makerobo_tfile.read()     # 读取到温度值\n",
    "    makerobo_tfile.close()                    # 关闭读取\n",
    "    try:\n",
    "        secondline = makerobo_text.split(\"\\n\")[1] # 格式化处理\n",
    "    except IndexError as e:\n",
    "        return 0\n",
    "    temperaturedata = secondline.split(\" \")[9]# 获取温度数据\n",
    "    temperature = float(temperaturedata[2:])  # 去掉前两位\n",
    "    temperature = temperature / 1000          # 去掉小数点\n",
    "    return temperature                        # 返回温度值\n",
    "\n",
    "# 循环函数\t\n",
    "def makerobo_loop():\n",
    "\twhile True:\n",
    "\t\tif makerobo_read() != None:  # 调用读取温度值，如果读到到温度值不为空\n",
    "\t\t\tprint (\"Current temperature : %0.3f C\" % makerobo_read()) # 打印温度值\n",
    "\n",
    "# 释放资源\n",
    "def destroy():\n",
    "\tpass"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "04b01200-b8f4-4906-9fef-ee5921375822",
   "metadata": {},
   "source": [
    "## 5.主程序"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "45e18609-d482-4008-9b7f-64ee3599f522",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.875 C\n",
      "Current temperature : 18.875 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.875 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.875 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.875 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.875 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.875 C\n",
      "Current temperature : 18.875 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.875 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.875 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.875 C\n",
      "Current temperature : 18.875 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.875 C\n",
      "Current temperature : 18.875 C\n",
      "Current temperature : 18.875 C\n",
      "Current temperature : 18.875 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.937 C\n",
      "Current temperature : 18.937 C\n",
      "Current temperature : 18.937 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.875 C\n",
      "Current temperature : 18.875 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.875 C\n",
      "Current temperature : 18.875 C\n",
      "Current temperature : 18.875 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.875 C\n",
      "Current temperature : 18.875 C\n",
      "Current temperature : 18.875 C\n",
      "Current temperature : 18.875 C\n",
      "Current temperature : 18.937 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.937 C\n",
      "Current temperature : 18.937 C\n",
      "Current temperature : 18.937 C\n",
      "Current temperature : 18.875 C\n",
      "Current temperature : 18.875 C\n",
      "Current temperature : 18.875 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.875 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.875 C\n",
      "Current temperature : 18.875 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.562 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.562 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.562 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.562 C\n",
      "Current temperature : 18.562 C\n",
      "Current temperature : 18.562 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.562 C\n",
      "Current temperature : 18.562 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.562 C\n",
      "Current temperature : 26.625 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.562 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 18.625 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : -128.015 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.687 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.875 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.812 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 18.750 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n",
      "Current temperature : 0.000 C\n"
     ]
    }
   ],
   "source": [
    "# 程序入口\n",
    "if __name__ == '__main__':\n",
    "\ttry:\n",
    "\t\tmakerobo_setup()  # 调用初始化程序\n",
    "\t\tmakerobo_loop()   # 调用循环函数\n",
    "\texcept KeyboardInterrupt: # 当按下Ctrl+C时，将执行destroy()子程序。\n",
    "\t\tdestroy()             # 释放资源"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "508a9361-13ac-4bfe-80b4-d9807402c286",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
